import React from 'react'
import { NavBar } from 'antd-mobile'
import { withRouter } from 'react-router-dom'
import './index.scss'
import PropTypes from 'prop-types'

function NavHeader ({ children, history, onLeftClick }) {
  const handleClick = () => history.go(-1)
  return (
    <NavBar
      mode="light"
      icon={<i className="iconfont icon-back" />}
      onLeftClick={onLeftClick || handleClick}
    >
      {children}
    </NavBar>
  )

}

export default withRouter(NavHeader)